using System;

namespace LDNS.Models
{
    /// <summary>
    /// DNS服务统计模型
    /// 作者：huobing
    /// </summary>
    public class DnsStatistics
    {
        /// <summary>
        /// 成功查询次数
        /// </summary>
        public long SuccessfulQueries { get; set; } = 0;
        
        /// <summary>
        /// 失败查询次数
        /// </summary>
        public long FailedQueries { get; set; } = 0;

        /// <summary>
        /// 总查询次数
        /// </summary>
        public long TotalQueries => SuccessfulQueries + FailedQueries;

        /// <summary>
        /// 总响应时间（毫秒）
        /// </summary>
        public double TotalResponseTimeMs { get; set; }
        
        /// <summary>
        /// 平均响应时间（毫秒）
        /// </summary>
        public double AverageResponseTime => TotalQueries > 0 ? TotalResponseTimeMs / TotalQueries : 0;

        /// <summary>
        /// 查询类型分布
        /// </summary>
        public Dictionary<string, long> QueryTypeDistribution { get; set; } = new Dictionary<string, long>();
    }
}